#!/usr/bin/env python
# -*- coding: utf-8 -*-

import datetime
import unittest
import tatolib.timeutil as timeutil

class TestTZ(unittest.TestCase):
    def test_create_tz(self):
        localtz = timeutil.LocalTZ()
        utctz = timeutil.UTCTZ()
    def test_add_tzobj(self):
        today    = timeutil.today()
        now      = timeutil.now()
        utctoday = timeutil.utctoday()
        utcnow   = timeutil.utcnow()
        def_now = datetime.datetime.now()
        # Verify istzaware() - datetime object from timeutil should
        # always be timezone-awared. 
        self.assertTrue(timeutil.istzaware(today))
        self.assertTrue(timeutil.istzaware(now))
        self.assertFalse(timeutil.isutctime(now))
        self.assertFalse(timeutil.isutctime(today))
        self.assertTrue(timeutil.isutctime(utcnow))
        self.assertTrue(timeutil.isutctime(utctoday))
        self.assertTrue(timeutil.istzaware(utctoday))
        self.assertTrue(timeutil.istzaware(utcnow))
        self.assertFalse(timeutil.istzaware(def_now))
    def test_day_str_conv(self):
        today = timeutil.utctoday()
        today_str = timeutil.daytostr(today)
        today_conv = timeutil.strtoutcday(today_str)
        self.assertTrue(today == today_conv)

# vim:tw=78:et:sw=4
